package Java0310;

import java.util.Scanner;

public class ArrayTest {
    public static void main(String[] args) {
        //定义一个整数数组，求数组中所有数的和 以及乘积
        Scanner scan = new Scanner(System.in);
        //长度为10的整型数组
        int[] array = new int[10];
        //总和
        int sum = 0;
        //乘积
        int product = 1;
        //初始化
        for (int i = 0; i < array.length; i++) {
            System.out.print("请输入第" + (i + 1) + "个数：");
            array[i] = scan.nextInt();
            sum += array[i];
            product *= array[i];
        }
        //遍历数组
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println("\n"+"sum=" + sum);
        System.out.println("product=" + product);
    }
}
